#include "ServerSelect.hpp"
int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        LOG(Level::FATAL) << "Usage add ip and port";
        exit(USAGE_ERRO);
    }
    int socketfd = socket(AF_INET, SOCK_STREAM, 0);
    if (socketfd < 0)
    {
        LOG(Level::FATAL) << "sockt fail";
        exit(SOCKET_ERRO);
    }
    InetAddr client(stoi(argv[2]), argv[1]);
    int n = connect(socketfd, client.getaddr(), client.getlen());
    if (n < 0)
    {
        LOG(Level::FATAL) << "connect fail";
        exit(CONNECT_ERRO);
    }
    while (true)
    {
        cout << "Please Enter:";
        string messages;
        getline(cin, messages);
        send(socketfd, messages.c_str(), messages.size(), 0);
    }
}